<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>

		<script>
			var str = '学习强国';
			var url = '%E5%AD%A6%E4%B9%A0%E5%BC%BA%E5%9B%BD';
			var res = encodeURI(str);
			document.write((res == url) + "<br>");
			document.write(res + "<br>");

			var res2 = decodeURI(url);
			document.write((res2 == str) + "<br>");
			document.write(res2 + "<br>");

			//下面的比上面的编码字符更多

			var res = encodeURIComponent(str);
			document.write((res == url) + "<br>");
			document.write(res + "<br>");

			var res2 = decodeURIComponent(url);
			document.write((res2 == str) + "<br>");
			document.write(res2 + "<br>");
		</script>
	</body>
</html>
